<?php
namespace Admin\Controller;
use Admin\Controller\AiController;
class ChengyuDuilianController extends AiController {
    public function add()
    {
        if (IS_POST) {
            foreach ($_POST as $k => $v){
                if (is_array($v))
                    $_POST[$k] = implode(",", $v);

            }
            $wheredata['title']=trim($_POST['title']);
            $wheredata['title1']=trim($_POST['title1']);
            $wheredata['_logic'] = 'OR';
            if(M('chengyu_duilian')->where($wheredata)->find()){
              $this->error('不可以添加相同的对联！');
            }else{
                         $this->insert();
            }
        } else {
            $this->display('form');
        }
    }
}